import {Injectable} from "@angular/core";
/**
 * Created by albert on 17/5/25.
 */
@Injectable()
export class PAYTYPE {

  transferPayTypeList(num: any) {
    if ([1, 2, 3, 4, 5, 6, 7].indexOf(parseInt(num)) < 0) {
      return [];
    }
    let payTypeList:any = [
      {value: 1, name: '押一付三'},
      {value: 2, name: '押一付一'},
      {value: 4, name: '租赁贷'}
    ];
    let list:any = [];
    let num_2_str = Array(4 - num.toString(2).length).join('0') + num.toString(2);
    num_2_str.split('').forEach((val, index) => {
      if (val == '1') {
        list.push(payTypeList[2 - index]);
      }
    });
    return list;
  }
}


